package com.code.springbootwebsocket.controller.v4;

import com.code.springbootwebsocket.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

/**
 * 功能描述：实时推送服务器的JVM负载，已用内存等消息
 * @author: liyufei
 * @date: 2019-02-16 20:17
 */
@Controller
public class ServerInfoController {

    @Autowired
    private WebSocketService webSocketService;

    @MessageMapping("/v4/schedule/push")
    @Scheduled(fixedRate = 3000)
    public void sendServerInfo() {
        webSocketService.sendServerInfo();
    }
}
